<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="huoyun" uri="/huoyun"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>发布车源信息</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/main.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/style_userCenter.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/theme/js/jquery-1.6.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/car/js/jarea-by-chengxin.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/car/js/publish-car-tzh.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/theme/js/calendar/WdatePicker.js"></script>

<script type="text/javascript">
	function add_event(e) {
		e.onmouseover = function() {
			e.className += ' hover';
		};
		e.onmouseout = function() {
			e.className = e.className.replace(' hover', '');
			e.className = e.className.replace(' active', '');
		};
		e.onmousedown = function() {
			e.className = e.className.replace(' hover', ' active');
		};
		e.onmouseup = function() {
			e.className = e.className.replace(' active', ' hover');
		};
	}
	
	/*
		切换是否整车时的网页端界面
	*/
	function switchType()
	{
		var type = $("input[name='carPubInfo.type']:checked").val();
		if (type == 0)
		{
			$("#un_total_div").slideToggle('fast');
		}
		else if (type == 1)
		{
			$("#un_total_div").slideToggle('fast');
		}
	}

	window.onload = function() {
		var button = document.getElementById('submit_button');
		add_event(button);
	};
</script>

<style type="text/css">
.submit_button {
	width: 100px;
	height: 40px;
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_normal.png");
	background-size: 100% 100%;
	border: none;
	cursor: pointer;
	font-family: 宋体;
	font-size: 18px;
	font-style: normal;
	color: #fff;
	font-weight: bold;
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_normal_ie.png")
		\9;
}

.submit_button:hover {
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_hover.png");
}

.submit_button:active {
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_down.png");
}

.delete_button {
	position: relative;
	left: 350px;
	background-image:
		url("${pageContext.request.contextPath}/theme/images/delete_normal.png");
	width: 70px;
	height: 26px;
	border: none;
	cursor: pointer;
	font-family: 宋体;
	font-size: 14px;
	font-style: normal;
	color: #555;
	font-weight: bold;
}
</style>

</head>

<body>
	<div>
		<jsp:include page="../userAdmin/nav.jsp">
			<jsp:param value="nav_main" name="nav" />
		</jsp:include>
	</div>
	<div class="realCer">

		<!--主体部分-->
		<div class="realMain clearfix mt10">
			<!--左侧菜单-->
			<div class="realLeft" id="meunLeft">
				<jsp:include page="../userAdmin/leftMenu.jsp">
					<jsp:param value="con_nav_main" name="con_nav" />
				</jsp:include>
			</div>
			<!--中间-->
			<div class="realRight ml10">
				<!--中间-->
				<div class="realR_left">
					<div class="box" style="width:805px;">
						<div class="tit">
							<strong>修改车源信息</strong>
						</div>
						<div class="con">
							<!-- <div id="hint" style="color:red"></div> -->
							<div class="form_wrap clearfix">
								<form method="post" name="carInfo" action="${pageContext.request.contextPath}/car/updateCarInfo.action?carPubInfoId=<%=request.getParameter("id")%>&carRouteAId=${carRouteA.id }&carRouteBId=${carRouteB.id }&carRouteCId=${carRouteC.id }">
									<table id="publish_car_table" cellpadding="5px">
										<!-- 车牌号 -->
										<tr>
											<td>车牌号：</td>
											<td id="number_td"><s:select id="carDetailID"
													name="carPubInfo.carId" list="carList" listKey="id"
													listValue="cardNumber" headerKey="-1"
													headerValue="-请选择已有车辆-" value="carPubInfo.carId"
													emptyOption="false" multiple="false" theme="simple">
												</s:select> &nbsp;&nbsp;&nbsp;&nbsp; <a
												href="${pageContext.request.contextPath}/car/selectRegCarMethod.action">添加新车辆</a>
											</td>
										</tr>
										<!-- 起始地 1-->
										<tr>
											<td id="xx2"><span class="red">* </span>运载路线：</td>
											<td id="AreaA">
												<huoyun:regionSelect provinceName="carRouteA.startProvince" cityName="carRouteA.startCity" townName="carRouteA.startTown" provinceValue="${carRouteA.startProvince }" cityValue="${carRouteA.startCity }" townValue="${carRouteA.startTown }"/>
												&nbsp;到&nbsp;
												<huoyun:regionSelect provinceName="carRouteA.endProvince" cityName="carRouteA.endCity" townName="carRouteA.endTown" provinceValue="${carRouteA.endProvince }" cityValue="${carRouteA.endCity }" townValue="${carRouteA.endTown }"/>
												<a href="javascript:;" id="addAreaHref">添加路线</a>
											</td>
										</tr>
										<!-- 起始地 2-->
										<s:if test="carRouteB != null">
											<tr id="Area2">
												<td id="xx2"><span class="red">* </span></td>
												<td id="AreaB">
													<huoyun:regionSelect provinceName="carRouteB.startProvince" cityName="carRouteB.startCity" townName="carRouteB.startTown" provinceValue="${carRouteB.startProvince }" cityValue="${carRouteB.startCity }" townValue="${carRouteB.startTown }"/>
													&nbsp;到&nbsp;
													<huoyun:regionSelect provinceName="carRouteB.endProvince" cityName="carRouteB.endCity" townName="carRouteB.endTown" provinceValue="${carRouteB.endProvince }" cityValue="${carRouteB.endCity }" townValue="${carRouteB.endTown }"/>
													<a href="javascript:;" id="deleteAreaHref2">删除</a>
												</td>
											</tr>
										</s:if>
										<s:else>
											<tr id="Area2" style="display:none;">
												<td id="xx2"><span class="red">* </span></td>
												<td id="AreaB">
													<huoyun:regionSelect provinceName="carRouteB.startProvince" cityName="carRouteB.startCity" townName="carRouteB.startTown" />
													&nbsp;到&nbsp;
													<huoyun:regionSelect provinceName="carRouteB.endProvince" cityName="carRouteB.endCity" townName="carRouteB.endTown"/>
													<a href="javascript:;" id="deleteAreaHref2">删除</a>
												</td>
											</tr>
										</s:else>
										<!-- 起始地3-->
										<s:if test="carRouteC != null">
											<tr id="Area3">
												<td id="xx2"><span class="red">* </span></td>
												<td id="AreaC">
													<huoyun:regionSelect provinceName="carRouteC.startProvince" cityName="carRouteC.startCity" townName="carRouteC.startTown" provinceValue="${carRouteC.startProvince }" cityValue="${carRouteC.startCity }" townValue="${carRouteC.startTown }"/>
													&nbsp;到&nbsp;
													<huoyun:regionSelect provinceName="carRouteC.endProvince" cityName="carRouteC.endCity" townName="carRouteC.endTown" provinceValue="${carRouteC.endProvince }" cityValue="${carRouteC.endCity }" townValue="${carRouteC.endTown }"/>
													<a href="javascript:;" id="deleteAreaHref3">删除</a>
												</td>
											</tr>
										</s:if>
										<s:else>
											<tr id="Area3" style="display:none;">
												<td id="xx2"><span class="red">* </span></td>
												<td id="AreaC">
													<huoyun:regionSelect provinceName="carRouteC.startProvince" cityName="carRouteC.startCity" townName="carRouteC.startTown" />
													&nbsp;到&nbsp;
													<huoyun:regionSelect provinceName="carRouteC.endProvince" cityName="carRouteC.endCity" townName="carRouteC.endTown"/>
													<a href="javascript:;" id="deleteAreaHref3">删除</a>
												</td>
											</tr>
										</s:else>
										
										<!-- 发车时间区间 -->
										<tr>
											<td>发车时间区间：</td>
											<td>
												<s:textfield name="carPubInfo.starttimeStr" id="fromDate" class="Wdate" style="width:180px" theme="simple" /> 
												到
												<s:textfield name="carPubInfo.endtimeStr" id="toDate" class="Wdate" style="width:180px" theme="simple" />
											</td>
										</tr>
										<!-- 最大可载吨位 -->
										<tr>
											<td><span class="red">* </span>最大可载吨位：</td>
											<td id="loadMaxTd">
												<s:textfield id="loadMax" name="loadMax" disabled="true" theme="simple" />
												<span>吨</span>
											</td>
										</tr>
										
										<tr>
											<td><span class="red">* </span>是否整车运输：</td>
											<td><s:radio id="carPubInfo.type" list="#{'0':'是','1':'否'}" name="carPubInfo.type" value="carPubInfo.type" onclick="switchType();" theme="simple"/></td>
										</tr>
									</table>
									
									<div id="un_total_div" style="display:none;">
										<table>
											<!-- 可运载货物数量 -->
											<tr>
												<td><span class="red">* </span>可运载重量：</td>
												<td id="loadAmountTd">
													<s:textfield id="loadAmount" name="carPubInfo.loadAmount" theme="simple" />
													<huoyun:customSelect mode="measureType" name="carPubInfo.unit" value="${carPubInfo.unit }"/>
												</td>
											</tr>
											<!-- 附加说明 -->
											<tr>
												<td style="width:100px; vertical-align:text-top;">
													附加说明(选填)：
												</td>
												<td id="otherInfoTd">
													<s:textarea id="otherInfo" name="carPubInfo.otherInfo" theme="simple" rows="5" cols="70"></s:textarea>
													<br>（您可以填写车辆中已有货物的描述信息，这样货主会更容易选择您的车辆哦~）
												</td>
											</tr>
										</table>
										<script type="text/javascript">
											var type = $("input[name='carPubInfo.type']:checked").val();
											if (type == 1)
											{
												$("#un_total_div").show();
											}
											else if (type == 1)
											{
												$("#un_total_div").hide();
											}
										</script>
									</div>
									
									<table>
										<!-- 默认联系方式 -->
										<tr>
											<td>默认联系方式：</td>
											<td>
												<s:textfield name="carPubInfo.defaultContact" disabled="true" theme="simple" theme="simple" />
												<s:textfield name="carPubInfo.defaultContact" theme="simple" style="display:none;" />
											</td>
										</tr>
										<!-- 紧急联系方式 -->
										<tr>
											<td>紧急联系方式：</td>
											<td>
												<s:textfield name="carPubInfo.urgentContact" id="emergencyTelephone" theme="simple" />
											</td>
										</tr>
										<!-- 车源信息结束 -->
									</table>
									<!-- <input type="submit" value="发&nbsp;布" class="submit_button"> -->
									<input type="submit" name="submitBtn" id="submitBtn"
										value="确认修改" class="submit_button" /> <input
										onclick="if(confirm('确定要删除该车源信息吗？')){this.form.action='/huoyun/car/deleteMyPublishedCar.action?carPubInfoId=<%=request.getParameter("id")%>&carRouteFromAId=${carRouteFromA.id }&carRouteFromBId=${carRouteFromB.id }&carRouteFromCId=${carRouteFromC.id }&carRouteToAId=${carRouteToA.id }&carRouteToBId=${carRouteToB.id }&carRouteToCId=${carRouteToC.id }'; this.form.submit();}"
										type="button" name="deleteBtn" id="deleteBtn" value="删&nbsp;除"
										class="delete_button" />
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-- 中间 -->
			</div>
			<!--中由-->
		</div>
	</div>
	<div>
		<jsp:include page="../footer.jsp"></jsp:include>
	</div>
</body>
</html>
